package com.zatech.cgnci.project.base.enums;

import lombok.Getter;

/**
 * 汇率类型枚举
 */
@Getter
public enum RateTypeEnum {
    /**
     * 固定汇率
     */
    FIXED_RATE("fixedRate", "固定汇率"),

    /**
     * 即期汇率
     */
    SPOT_RATE("spotRate", "即期汇率"),

    /**
     * 预算汇率
     */
    BUDGET_RATE("budgetRate", "预算汇率");

    private final String code;
    private final String desc;

    RateTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    
    public static RateTypeEnum getEnumByCode(String code) {
        for (RateTypeEnum type : RateTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
